<template>
  <div class="alipay"></div>
</template>

<script>
import { alipayGetAuthorizationUrl } from "../api/reply";

export default {
  data() {
    return {
      url: "",
    };
  },
  methods: {
    alipayGetAuthorizationUrl() {
      window.localStorage.setItem("access_token", this.$route.query.token);
      alipayGetAuthorizationUrl({}).then((res) => {
        console.log(res);
        if (res.code == 0) {
          console.log(res);
          location.href =
            "alipays://platformapi/startapp?appId=20000067&url=" +
            res.data.data.url;
        }
      });
    },
    a() {
      // this.url =
      //   "alipays://platformapi/startapp?appId=20000067&url=https" +
      //   '%3A%2F%2Fopenauth.alipay.com%2Foauth2%2FpublicAppAuthorize.htm%3Fapp_id%3D2021002147645086%26scope%3Dauth_base%26redirect_uri%3Dhttp%3A%2F%2Fapi.dev.pay.psychexy.com%2Fauthorization%2Falipay%26state%3D{"app_id":1,"channel_id":2}';
      // this.url =
      //   "alipays://platformapi/startapp?appId=20000067&url=https" +
      //   "%3A%2F%2Fopenauth.alipay.com%2Foauth2%2FpublicAppAuthorize.htm%3Fapp_id%3D2021002147645086%26scope%3Dauth_base%26redirect_uri%3Dhttp%3A%2F%2Fapi.dev.pay.psychexy.com%2Fauthorization%2Falipay%26state%3D%7B%22app_id%22%3A1%2C%22channel_id%22%3A2%7D";
      // location.href = this.url;
    },
  },
  created() {
    // this.a();
    this.alipayGetAuthorizationUrl();
  },
};
</script>

<style lang="less" scoped>
.alipay {
  background: url("../assets/image/shouquan.png") no-repeat 50% 50%;
  background-size: 50%;
  width: 100%;
  height: 100%;
  color: black;
}
</style>